package com.atguigu.jxc.controller;

import com.atguigu.jxc.domain.ServiceVO;
import com.atguigu.jxc.entity.DamageList;
import com.atguigu.jxc.entity.OverflowList;
import com.atguigu.jxc.service.OverflowService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.Map;

/**
 * ClassName: OverflowController
 * Package: com.atguigu.jxc.controller
 *
 * @Description:
 * @Author: xvyy
 * @Create: 2025/2/21 - 22:29
 * @Version: v1.0
 */
@RestController
@RequestMapping("/overflowListGoods")
public class OverflowController {


    @Autowired
    private OverflowService overflowService;

    /**
     * 保存溢出单商品信息
     *
     * @param overflowList 溢出单对象
     * @param overflowListGoodsStr 溢出单商品信息字符串
     * @param session 会话对象
     * @return ServiceVO 保存保存溢出单结果
     */
    @PostMapping("/save")
    @RequiresPermissions(value = {"商品报溢", "库存管理"})
    public ServiceVO save(OverflowList overflowList, String overflowListGoodsStr, HttpSession session) {
        return overflowService.save(overflowList, overflowListGoodsStr, session);
    }

    /**
     * 溢出单列表
     *
     * @param sTime 溢出单开始时间
     * @param eTime 溢出单结束时间
     * @return Map<String, Object> 溢出单列表数据
     */
    @PostMapping("/list")
    @RequiresPermissions(value = {"商品报溢", "库存管理"})
    public Map<String, Object> list(String sTime, String eTime) {
        return overflowService.list(sTime, eTime);
    }

    /**
     * 溢出单商品列表
     *
     * @param overflowListId 溢出单id
     * @return Map<String, Object> 溢出单商品列表数据
     */
    @PostMapping("/goodsList")
    @RequiresPermissions(value = {"商品报溢", "库存管理"})
    public Map<String, Object> goodsLis(Integer overflowListId) {
        return overflowService.goodsLis(overflowListId);
    }
}
